package com.hilihili.job;

import com.hilihili.service.IVideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

/**
 * 视频发布定时任务
 *
 * @author machi
 * @date 2023/12/29
 */

public class VideoPublishSchedule {
    @Autowired
    IVideoService videoService;


    /**
     * 每一分钟扫描一次数据库 查询需要发布的视频
     */
    @Scheduled(cron = "0 0/1 * * * ? ")
    public void publishVideo() {
        boolean flag = videoService.publishVideoByPublishTime(LocalDateTime.now());
    }
}
